<me:UIKDADR x:Class="WPFExcelReport.TKD052"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIKDADR.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:SDKEYCONV x:Key="sv"/>
    </me:UIKDADR.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/> 
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <WrapPanel Grid.Row="0"> 
                <Grid Margin="10,0,0,0"  IsEnabled="{Binding IsCanNew,ElementName=TV}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" IsEnabled="{Binding IsCanChg,ElementName=TV}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <WrapPanel Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid Margin="10,0,0,0" IsEnabled="{Binding IsCanDelete,ElementName=TV}" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                </WrapPanel>                
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>     
            </WrapPanel>
            <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=地址类型:}}"></TextBlock>
                    <SD:K8883 Grid.Column="1" 
                              Visibility="Collapsed"
                              KEY="{Binding KDAADRSL,ElementName=TV}"
                              IsEdit="True"
                                />
                    <ex:TXT72 Grid.Column="2" MaxLength="8" 
                              Text="{Binding ART,ElementName=TV,Converter={StaticResource gb2312}}" 
                              IsAutoClear="False" Width="80"/>
                </Grid>
                <Grid Margin="10,0,0,0"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </Grid>
            </WrapPanel>
            <KD:TSKD02   MinWidth="100" 
                   KEY="{Binding Path= EXAUF,ElementName=TV}"  
                   IsEdit="True"  />
            <WrapPanel> 
            <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户名:}}"></TextBlock>
                <TextBox Grid.Column="1"   CharacterCasing="Upper"  
                         Text="{Binding ART,ElementName=TV, Converter={StaticResource ResourceKey=gb2312}}"
                         Width="100" />
            </Grid>
            <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=地址:}}"></TextBlock>
                <TextBox Grid.Column="1"   CharacterCasing="Upper"  
                         Text="{Binding FARBE,ElementName=TV, Converter={StaticResource ResourceKey=gb2312}}"
                         Width="200" />
            </Grid>
            <Grid> 
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0" Height="20"  Width="24" Margin="0,0,0,0"  Click="QueryCommand">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
                <TextBlock Grid.Column="1" Text="{Binding Source={Localization:Translate Word=查询}}"></TextBlock>
            </Grid>
          </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="True"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                   MaxHeight="400"
                >
            <DataGrid.Columns>                
                <!--DataGridTextColumn Binding="{Binding Path=KDAADRSL,Converter={StaticResource ResourceKey=sv}, ConverterParameter=8883}" Header="{Binding Source={Localization:Translate Word=类型}}" Visibility="Collapsed" Width="Auto" /-->
                <DataGridTextColumn Binding="{Binding Path=KDAADRSL,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=类型}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=KDASTRASSE1,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=地址}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIKDADR> 
 
